//
//  ALPS_MainCollectionViewCell.m
//  Alps
//
//  Created by dllo on 16/6/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ALPS_MainCollectionViewCell.h"

@implementation ALPS_MainCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.mainImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_mainImageView];
        [self.mainImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_offset(UIEdgeInsetsMake(0, 0, (ScreeHeight / 2.668 - 65) - ((ScreeWidth - 40) / 3), 0));
        }];
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.numberOfLines = 2;
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_offset(UIEdgeInsetsMake((ScreeWidth - 40) / 3 + 10, 0, 30, 10));
        }];
        
        self.userLabel = [[UILabel alloc] init];
        self.userLabel.font = [UIFont systemFontOfSize:13];
        self.userLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_userLabel];
        [self.userLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_offset(UIEdgeInsetsMake((ScreeHeight / 2.668 - 65) - 25, 0, 8, 0));
        }];

    }
    return self;
}

- (void)setModel:(ALPS_MainModel *)model
{
    if (_model != model) {
        _model = model;
        [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:model.coverMiddle]];
        self.titleLabel.text = model.intro;
        self.userLabel.text = model.title;
    }
}

@end
